home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gb.d64
/
hangman.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
7KB
|
228 lines
1 REM HANGMAN
2 REM
3 REM (C) LARRY PHILLIPS
4 REM VANCOUVER B.C.
5 REM (604)325-6224
6 REM
7 REM I BELIEVE IN FREE OR CHEAP SOFTWARE,JUST LEAVE THE CREDITS.
8 REM
9 REM MODIFIED BY G J FLYNN
10 REM
11 POKE53280,6:POKE53281,14:PRINT"[144]"
12 REM
13 REM*********************************
14 REM* MODIFIED SLIGHTLY AT 0233H ON *
15 REM* APRIL THE 5TH, 1985 BY *
16 REM* DAVID BRADLEY *
17 REM*********************************
18 REM
30 PRINT"[147]"TAB(16)"HANGMAN."
40 PRINT:PRINTTAB(7)"DO YOU NEED INSTRUCTIONS?"
50 GETI$
60 IFI$="Y"THEN90
70 IFI$="N"THEN200
80 GOTO50
90 PRINT"[147] I WILL THINK OF A WORD."
100 PRINT"THE DASHES ([192][160][192][160][192]) WILL SHOW YOU"
105 PRINT"HOW MANY LETTERS IT HAS.":PRINT
110 PRINT"IF YOU GUESS A LETTER CORRECTLY,"
115 PRINT"I WILL PUT IT INTO THE WORD, AND GIVE"
116 PRINT"YOU A CHANCE TO GUESS THE WHOLE WORD.":
118 PRINT"IF YOU DON'T WANT TO GUESS THE WORD THENPRESS 'SPACE'.":PRINT
120 PRINT"IF YOU ARE WRONG, I WILL DRAW ANOTHER"
125 PRINT"PART OF THE MAN.":PRINT
130 PRINT"THE MAN WILL BE COMPELTELY DRAWN AFTER"
135 PRINT"TEN WRONG GUESSES.(AND WILL BE HUNG)":PRINT
140 PRINT:PRINT"HE IS DEPENDING ON YOU!":PRINT:PRINT
189 PRINT"DO YOU WANT TO PLAY NOW?"
190 GETI$:IFI$="Y"THEN200
191 IFI$="N"THEN1999
192 GOTO190
200 PRINT"[147]WORKING...."
203 GOSUB2500:SYS704:GOSUB2000
204 POKE53281,0:POKE53281,6
210 POKEX(1)+Y(0),85
220 POKEX(5)+Y(0),74
230 POKEX(1)+Y(21),73
240 POKEX(5)+Y(21),75
250 FORI=1TO20:POKEX(1)+Y(I),64
260 POKEX(5)+Y(I),64:NEXTI
270 POKEX(4)+Y(0),93:POKEX(4)+Y(21),93
280 POKEX(3)+Y(0),93:POKEX(3)+Y(21),93
290 POKEX(2)+Y(0),93:POKEX(2)+Y(21),93
300 FORI=26TO39:POKEX(0)+Y(I),160:NEXTI
310 FORI=0TO24:POKEX(I)+Y(39),160:NEXTI
320 FORI=26TO38:POKEX(23)+Y(I),206
330 POKEX(24)+Y(I),207:NEXTI
340 POKEX(23)+Y(26),233:POKEX(23)+Y(39),232
350 POKEX(1)+Y(35),95:POKEX(1)+Y(36),223
360 POKEX(2)+Y(36),95:POKEX(2)+Y(37),223
370 POKEX(3)+Y(37),95:POKEX(3)+Y(38),223
380 POKEX(4)+Y(38),95:POKEX(1)+Y(28),66
390 POKEX(2)+Y(28),66:POKEX(3)+Y(28),66
400 POKEX(24)+Y(39),207
410 PRINT" LETTERS GUESSED"
420 PRINT""
430 GOSUB2050:GOSUB2200:GOSUB2260
460 GOSUB3000:GOSUB3010:GOSUB3020
490 GOSUB3030:GOSUB3040:GOSUB3050
510 GOSUB3050
520 GOSUB3060:PRINTTAB(10)"HANGMAN"
540 FORI=1TO3000:NEXTI
550 PRINTTAB(10)"[145] [145]":GOSUB2300
560 DIMLG$(26),W$(50),WU%(50):DIMLM$(12)
570 FORI=0TO49:READW$(I):NEXTI
580 FORI=0TO49:WU%(I)=0:NEXTI
590 S1=0:S2=0:FL=0
600 FOR I=0TO25:LG$(I)=" ":NEXTI
605 WR=0:NC=0:GOSUB3140
610 W=INT(RND(1)*50):IFWU%(W)=1THEN610
611 NW=NW+1
612 IFNW<50THEN620
615 PRINT"YOU TRIED ";NW;"WORDS":
616 PRINT:PRINT"YOU GUESSED";NR;"OF THEM"
617 PRINT"AND HUNG THE POOR FELLOW";NH;"TIMES";"":
618 END
620 WU%(W)=1:NL=LEN(W$(W)):PRINT""
630 FORI=1TONL:PRINT" [192]";:NEXTI:PRINT
635 N=-1
640 FORI=1TO11:LM$(I)="[192]":NEXTI
650 PRINT"GUESS A LETTER? ";
660 GETL$:FL=0:IFL$<"A"THEN660
665 PRINTL$
670 IFL$>"Z"THEN660
680 FORI=0TO25
681 IFLG$(I)<>L$THEN689
685 FL=1
687 GOSUB7300
689 NEXTI
690 IFFL=1THEN650
695 N=N+1
700 FORI=1TONL
710 IFL$<>MID$(W$(W),I,1)THEN740
720 LM$(I)=L$
730 FL=1
740 NEXTI
745 LG$(N)=L$
750 IFFL=1THEN1050
760 WR=WR+1
770 PRINT:PRINT"SORRY, THAT LETTER "
780 PRINT"IS NOT IN THIS WORD":PRINT
785 GOSUB3200
790 ONWRGOSUB800,810,820,830,840,850,860,870,880,890
795 GOTO650
800 PRINT"YOU GET A HEAD":GOSUB7000:GOSUB2050:GOSUB3070:GOSUB3140:RETURN
810 PRINT"HERE'S THE BODY.":GOSUB7000:GOSUB2200:GOSUB3070:GOSUB3140:RETURN
820 PRINT"NOW HIS FIRST LEG":GOSUB7000:GOSUB2260:GOSUB3070:GOSUB3140:RETURN
830 PRINT"SECOND LEG!":GOSUB7000:GOSUB3000:GOSUB3070:GOSUB3140:RETURN
840 PRINT"THIS GETS YOU AN ARM":GOSUB7000:GOSUB3030:GOSUB3070:GOSUB3140:RETURN
850 PRINT"THE OTHER ARM...":GOSUB7000:GOSUB3040:GOSUB3070:GOSUB3140:RETURN
860 PRINT"OH NO! A FOOT!":GOSUB7000:GOSUB3010:GOSUB3070:GOSUB3140:RETURN
870 PRINT"HEY, DON'T HANG ME!!":GOSUB7000:GOSUB3020:GOSUB3070:GOSUB3140:RETURN
880 PRINT"A HAND--ONLY ONE LEFT":GOSUB7000:GOSUB3050:GOSUB3070:GOSUB3140:RETURN
890 PRINT"AAARGH! I'M HUNG!":GOSUB7000:NH=NH+1:GOSUB3060:GOSUB3070:GOTO900
900 GOSUB7100:GOSUB7200:PRINT"";:FORI=1TO20:PRINT" ";:NEXTI:PRINT
1000 PRINT"";:FORI=1TO20:PRINT" ";:NEXTI:PRINT
1010 PRINT"";:FORI=1TO20:PRINT" ";:NEXTI:PRINT
1015 PRINT"";:FORI=1TO20:PRINT" ";:NEXTI
1020 GOSUB3140:GOSUB2300:GOTO600
1050 PRINT:PRINT"THAT'S A GOOD ONE!"
1060 PRINT"HERE'S WHERE IT GOES"
1070 GOSUB7000:GOSUB3070:GOSUB3140:FL=0
1080 FORI=0TONL
1090 IFLM$(I)="[192]"THENFL=1
1095 NEXTI:IFFL=1THEN1150
1100 PRINT"":PRINT"GOT IT IN ";N+1;"GUESSES!"
1105 NR=NR+1
1110 FORI=1TO1500:NEXTI
1120 FORI=0TO21:POKEX(9)+Y(I),32:NEXTI
1130 FORI=0TO19:POKEX(11)+Y(I),32:NEXTI
1140 GOSUB2300:GOSUB7200:GOTO600
1150 GOSUB3220:GOSUB3140:IFFL=1THEN650
1160 GOTO1100
1998 PRINT"END"
1999 END
2000 DIMX(24),Y(39)
2010 J=1024
2020 FORI=0TO24:X(I)=J:J=J+40:NEXTI
2030 FORI=0TO39:Y(I)=I:NEXTI
2040 RETURN
2050 FORI=27TO29:POKEX(4)+Y(I),99:NEXTI
2060 POKEX(4)+Y(26),78:POKEX(7)+Y(30),78
2070 POKEX(4)+Y(30),77:POKEX(7)+Y(26),77
2080 POKEX(5)+Y(25),118:POKEX(6)+Y(25),103:POKEX(5)+Y(31),117
2090 POKEX(6)+Y(31),101:POKEX(8)+Y(27),99:POKEX(8)+Y(29),99
2100 POKEX(5)+Y(27),81:POKEX(5)+Y(29),81:POKEX(6)+Y(28),87
2110 POKEX(7)+Y(27),74:POKEX(7)+Y(28),64:POKEX(7)+Y(29),75
2180 POKEX(8)+Y(28),224
2190 RETURN
2200 FORI=9TO14:FORJ=26TO30
2210 POKEX(I)+Y(J),224:NEXTJ:NEXTI
2220 POKEX(9)+Y(28),150:FORI=10TO12
2230 POKEX(I)+Y(28),218:NEXTI
2240 FORI=26TO30:POKEX(13)+Y(I),226:NEXTI
2250 RETURN
2260 FORI=26TO27:FORJ=15TO18:POKEX(J)+Y(I),102:NEXTJ:NEXTI
2270 FORI=26TO30:POKEX(14)+Y(I),102:NEXTI
2280 RETURN
2300 FORI=4TO19:FORJ=25TO31:POKEX(I)+Y(J),32:NEXTJ:NEXTI:RETURN
2500 FORA=704TO732:READTT:POKEA,TT:NEXTA:RETURN
2510 DATA 169,0,133,140,169,219,133,141,169,3,160,255,145,140,136,192,0,208,249
2520 DATA 198,141,164,141,192,215,208,239,96,0
3000 FORI=29TO30:FORJ=15TO18:POKEX(J)+Y(I),102:NEXTJ:NEXTI:RETURN
3010 POKEX(18)+Y(25),111:POKEX(19)+Y(25),226:POKEX(19)+Y(26),226
3015 POKEX(19)+Y(27),226:RETURN
3020 FORI=29TO31:POKEX(19)+Y(I),226:POKEX(18)+Y(31),111:NEXTI:RETURN
3030 FORI=10TO13:POKEX(I)+Y(25),231:NEXTI:POKEX(9)+Y(25),233:RETURN
3040 FORI=10TO13:POKEX(I)+Y(31),229:NEXTI:POKEX(9)+Y(31),223:RETURN
3050 POKEX(14)+Y(25),81:RETURN
3060 POKEX(14)+Y(31),81:RETURN
3070 PRINT"";
3080 FORI=0TO9:PRINTLG$(I);" ";:NEXTI:PRINT
3090 PRINT"";:FORI=10TO19:PRINT" ";LG$(I);:NEXTI:PRINT
3100 PRINT"";:FORI=20TO25:PRINTLG$(I);" ";:NEXTI:PRINT
3110 PRINT"":FORI=1TONL:PRINT" ";LM$(I);:NEXTI:PRINT
3130 RETURN
3140 FORI=0TO21:POKEX(14)+Y(I),32:POKEX(16)+Y(I),32:POKEX(17)+Y(I),32
3145 POKEX(10)+Y(I),32:NEXTI
3150 GOSUB3200
3160 RETURN
3200 FORI=0TO21:POKEX(19)+Y(I),32:NEXTI
3210 RETURN
3220 PRINT:PRINT:PRINT:PRINT:PRINT"GUESS THE WORD?":FL=0:PRINT"[145][145][145][145][145]";
3230 FORI=1TONL
3240 GETI$:IFI$=" "THENFL=1:I=NL:GOTO3275
3245 IFI$<"A"THEN3240
3250 IFI$>"Z"THEN3240
3260 IFI$<>MID$(W$(W),I,1)THENFL=1
3270 PRINT" ";I$;
3275 NEXTI
3280 RETURN
6000 GOTO600
7000 FORPS=1TO1000:NEXTPS:RETURN
7100 POKE1251,43:POKE1253,43:POKE1331,85:POKE1332,64:POKE1333,73
7110 GOSUB7000:RETURN
7200 PRINT"";"THE WORD WAS ";"";W$(W);"[146]":GOSUB7000
7210 PRINT"";"...ANOTHER WORD?"
7215 GETI$
7220 IFI$="Y"THENPRINT"[145][145][145][145]";" ":RETURN
7230 IFI$="N"THENPRINT"[147]";"OK.....THANKS FOR THE GAME!";"":GOTO615
7240 GOTO7215
7300 PRINT"";" ALREADY PICKED ";L$:GOSUB7000:GOSUB3140:RETURN
10010 DATA MAGISTRATE,MAHOGANY,ANSWER
10020 DATA CASTLE,INTEREST,VACUUM,MOOSE
10030 DATABASKET,AUTOMOBILE,CONSERVE
10040 DATAANIMOSITY,FRUSTRATE,OGLE,SKIING
10050 DATACIGARETTE,CREDENZA,CREDENTIALS
10060 DATAHAMMOCK,SAILBOAT,BUILDING,DOOM
10070 DATATELEPHONE,RADIOLOGY,MIXTURE
10080 DATAKEYBOARD,TYPEWRITER,FEMUR
10090 DATADECADE,PARTIAL,OOZE,EMULATE
10100 DATAFIREPLACE,CREATURE,FROZEN
10110 DATATONGUE,CLOTHING,ELEVATOR
10120 DATADRAPERIES,HANGMAN,RELINQUISH
10130 DATAQUADRANGLE,TRIANGLE,LOCATION
10140 DATAINDICATE,BUFFOON,MUDDLE
10150 DATASEQUENTIAL,ABDICATE,AARDVARK
10160 DATARUTABAGA